package com.itheima.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * @program: sharding_sphere
 * @description: 这个是Order的mapper层
 * @author: zhanghz001
 * @create: 2021-03-18 09:06
 **/
@Mapper
public interface UserMapper {
    //插入用户
    @Insert("insert into t_user(fullname,user_type)values(#{fullname},#{userType})")
    public int insertUser(@Param("fullname") String fullname, @Param("userType") String userType);
    
    //根据id查询多个用户
    @Select("<script>" +
            "select" +
            " * " +
            " from t_user t " +
            " where t.user_id in " +
            " <foreach collection='userIds' open='(' separator=',' close=')' item='id'>" +
            " #{id} " +
            " </foreach>" +
            "</script>")
    public List<Map> selectListByOrderIds(@Param("userIds") List<Long> userIds);
}
